package hu.stud.uszeged.inf.prf.prftrac.session.dao;

import hu.stud.uszeged.inf.prf.prftrac.entity.User;

import javax.persistence.EntityManager;
import javax.persistence.Query;

import org.jboss.seam.annotations.In;
import org.jboss.seam.annotations.Name;

@Name("userDao")
public class UserDao {

	@In
	private EntityManager entityManager;
	
	public User getUserByNickName(String nickName) {
    	String queryString = "from User u where u.nickName=:nname";
    	Query q = entityManager.createQuery(queryString);
    	q.setParameter("nname", nickName);
    	return (User) q.getSingleResult();
    }
}
